package com.promis.widget.recycler;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by jidanbo on 2018/6/7.
 */

public class StaggeredSpacesItemDecoration extends RecyclerView.ItemDecoration {

    private Context context;
    private int dividerDimen;

    public StaggeredSpacesItemDecoration(Context context, int dividerDimen) {
        this.context = context;
        this.dividerDimen = dividerDimen;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.right = dividerDimen;
        outRect.bottom = dividerDimen;
//        int pos = parent.getChildLayoutPosition(view);
//        if (pos < spanCount) {
//            outRect.top = 0;
//        } else {
//            outRect.top = dividerDimen;
//        }
    }
}
